package ooday05;
/** static final常量的演示 */
public class StaticFinalDemo {
    public static void main(String[] args) {
        System.out.println(Loo.PI);//常常通过类名来访问
        //Loo.PI = 3.141815;//编译错误,常量不能被修改

        //先加载Loo.class文件到方法区中
        //将静态变量num存储到方法区中
        //从方法区中取出静态变量num并输出
        System.out.println(Loo.num);

        //编译器在编译阶段就会将常量转换为具体的数,效率高
        System.out.println(Loo.COUNT);
    }
}

class Loo{
    public static int num = 5;
    public static final int COUNT = 5;

    public static final double PI= 3.14159;
}